package com.cx.meta.exception;

import com.cx.meta.enums.ErrCode;

/**
 * @author flysand
 * @package com.cx.web.exception
 * @date 2021-11-07 18:23
 * @des CxException :
 */
public class CxException extends RuntimeException {

    private String code;
    private String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    private ErrCode errCode;

    public CxException() {

    }

    public CxException(CxErrorCode errorCode) {
        this.code = errorCode.getErrCode();
        this.message = errorCode.getErrMsg();
    }

    public CxException(ErrCode errCode) {
        this.errCode = errCode;
        this.code = String.valueOf(errCode.getCode());
        this.message = errCode.getMsg();
    }

    public CxException(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public ErrCode getErrCode() {
        return errCode;
    }

    public void setErrCode(ErrCode errCode) {
        this.errCode = errCode;
    }
}
